/*
 * This file is part of aKoustiK.

 * aKoustiK is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * aKoustiK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with aKoustiK.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <KToolBar>

#include <QtGui/QHBoxLayout>

#include <kore.h>
#include <ui/player/volumewidget.h>

VolumeWidget::~VolumeWidget() {
}

VolumeWidget::VolumeWidget(QWidget *parent) : QWidget(parent) {

    player = Kore::instance().player();

    KToolBar* bar = new KToolBar(this);
    bar->addAction(Kore::instance().actionCollection()->action("mute"));

    volumeSlider = new QSlider(this);
    volumeSlider->setOrientation(Qt::Horizontal);
    volumeSlider->setMinimum(0);
    volumeSlider->setMaximum(100);
    volumeSlider->setTickInterval(1);
    volumeSlider->setValue(player->volume());

    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->addWidget(bar);
    layout->addWidget(volumeSlider);

    connect(volumeSlider, SIGNAL(valueChanged(int)), player, SLOT(setVolume(int)));
    connect(player, SIGNAL(volumeChanged(int)), volumeSlider, SLOT(setValue(int)));

}
